home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-01-28 | 17.8 KB | 427 lines | [TEXT/ALFA] |
- ## -*-Tcl-*-
- # ###################################################################
- # Alpha - new Tcl folder configuration
- #
- # FILE: "globals.tcl"
- # created: 13/6/94 {9:39:12 pm}
- # last update: 28/1/99 {10:32:48 pm}
- #
- # Reorganisation carried out by Vince Darley with much help from Tom
- # Fetherston, Johan Linde and suggestions from the Alpha-D mailing list.
- # Alpha is shareware; please register with the author using the register
- # button in the about box.
- #
- # ###################################################################
- ##
-
- namespace eval flag {}
- namespace eval global {}
-
- proc alpha::getGlobalPreferences {} {}
-
-
- ensureset tclvars {}
- ensureset allFlags {}
- ensureset allVars {}
- set invisibleModeVars(wordWrap) 1
-
- proc flag::options {v} {
- global flag::list
- set thelist [set flag::list($v)]
- set litems [lindex $thelist 1]
- switch -- [lindex $thelist 0] {
- "varitem" {
- return [uplevel \#0 "set $litems"]
- }
- "varindex" {
- return [uplevel \#0 "set $litems"]
- }
- "array" {
- global $litems
- return [lsort [array names $litems]]
- }
- }
- return $litems
- }
-
- catch {newPref linkflag lockStatus 1}
- # To scroll the horizontal scrollbar automatically to follow your typing,
- # click this box||To enforce manual use of the horizontal scroll bar,
- # click this box.
- newPref linkflag autoHScroll 1
- # To save files automatically (except untitled buffers) every 'changesLim'
- # changes, click this box||To disable the automatic saving of files, click
- # this box.
- newPref linkflag autoSave 0
- # To make the cursor blink, click this box||To stop the cursor blinking,
- # click this box
- newPref linkflag blinkingCursor 1
- # To use a solid rectangular cursor, click this box||To use a thin vertical
- # cursor, click this box.
- newPref linkflag blockCursor 0
- # To color words according to mode and context, click this box||To display all
- # text more quickly, but in plain black and white, click this box.
- newPref linkflag coloring 1
- # To enable drag and drop editing using the mouse, click this box||To disable
- # drag and drop editing using the mouse, click this box.
- newPref linkflag dragAndDrop 1
- # To display a horizontal scrollbar in new windows, click this box||To make
- # maximum use of window space and not use a horizontal scrollbar, click this box.
- newPref linkflag horScrollBar 1
- # To enable clicking on hypertext items, click this box||To disable clicking
- # on hypertext items, click this box
- newPref linkflag hyperText 1
- # To force the insertion point to move with 'pageBack' and 'pageForward'
- # commands, click this box||To leave the insertion point in place (usually
- # offscreen) after 'pageBack' and 'pageForward' commands, click this box
- newPref linkflag moveInsertion 1
- # To list all file types (as opposed to just 'TEXT') in open/save dialog
- # boxes, click this box||To display only 'TEXT' files in open/save dialog
- # boxes, click this box.
- newPref linkflag openAllFiles 0
- # To make the window scroll dynamically while using vertical scrollbars,
- # click this box||To make the window scroll only after releasing the button
- # in a vertical scrollbar, click this box
- newPref linkflag powerThumb 1
- # Respect projector resources
- newPref linkflag projectorAware 1
- # To show all tabs, carriage returns, spaces etc with distinct symbols,
- # click this box||To display whitespace characters normally, click this box.
- newPref linkflag showInvisibles 0
- # To use a small font for the various pop-up menus (e.g. marks menu), click this
- # box||To use the standard system font for the popup menus, click this box.
- newPref linkflag smallMenuFont 1
- # if set, sorted is the default for function and section menus
- newPref linkflag sortedIsDefault
- # To allow tearing off of menus, click this box||To disable tearing-off of
- # menus, click this box
- newPref linkflag tearoffMenus 1
- # To enable Alpha's use of system temporary memory, click this box||To disallow
- # Alpha from using system temporary memory, click this box.
- newPref linkflag tempMem 1
- # To retain editing information to allow undo/redo operations, click this box||
- # To edit destructively (saving memory, and operating a little faster in, for
- # example global replaces), click this box.
- newPref linkflag undoOn 1
- # To automatically insert a carriage-return when you exceed a line
- # length of 'fillColumn' characters, click this box||To disable automatic
- # text wrapping, click this box.
- newPref linkflag wordWrap 1
- # To add a description of each preference to the standard dialogs, click this
- # box||To use standard preference dialogs, with a 'Help' button to display
- # descriptions, click this box
- newPref flag includeDescriptionsInDialogs 0
- # Used by completion routines: if there is a selection and you and
- # trying to complete something, and this item is set, Alpha will ask before
- # deleting the selection.|| Used by completion routines: if there is a
- # selection and you and trying to complete something, and this item is set,
- # Alpha will ask before deleting the selection.
- newPref flag askDeleteSelection 0
- # To make a backup every time a file is saved, click this box||To save disk
- # space and not make backup copies when saving files, click this box.
- newPref flag backup 0
- # To force newly opened windows onto the main screen, click this box||To allow
- # new windows to be opened anywhere, including off screen, click this box.
- newPref flag forceMainScreen 1
- # To iconify windows when you switch to another application, click this box||
- # To leave windows alone when switching to other applications, click this box.
- newPref flag iconifyOnSwitch 0
- # To insert/remove spaces to ensure a single space between words when cutting
- # or pasting, click this box||To cut/paste precisely what is selected, click
- # this box.
- newPref flag intelCutPaste 1
- # To sort the items in the popup function menu '{}', click this box||To leave
- # the items in the popup function menu '{}' in the order in which they appear,
- # click this box.
- newPref flag sortFuncsMenu 1
- # To place two spaces after the '.' at the end of each sentence when
- # filling blocks of text, click this box|| To place only a single space
- # after the '.' at the end of each sentence when
- # filling blocks of text, click this box
- newPref flag doubleSpaces 1
- # To print a header at the top of each printed page, click this box||
- # To print only the contents of the window, without any identifying header,
- # click this box.
- newPref flag printHeader 1
- # To include a file's full path in the printed header, click this box
- # ||To place just a file's name in the printed header, click this box
- newPref flag printHeaderFullPath 0
- # To include the current time in printed headers, click this box
- # ||To remove the current time from printed headers, click this box
- newPref flag printHeaderTime 1
- # To choose from a listbox of possible completions if you try to
- # complete a command for which no unique
- # suffix exists, click this box.||To abort the completion if no
- # unique suffix exists, click this box.
- newPref flag listPickIfMultCmps 1
- # if we have a choice between, say \left, \leftRight, \leftMore,
- # then we don't get stuck on '\left' with this option.
- newPref flag listPickIfNonUniqueStuckCmp 1
- # To clear old marks automatically when you select 'Mark File',
- # click this box.|| To check before clearing old marks, click this box.
- newPref flag quietlyClearMarks 1
- # Folder in which to store backups. A null value tells Alpha to use
- # the file's current directory.
- newPref var backupFolder ""
- # Extension to add to files when backing them up
- newPref var backupExtension "~"
- # If the previous backup is more recent than this number of hours,
- # then don't make a new backup. If greater than zero, this means the
- # backups Alpha has tend to be significantly different to the current file.
- newPref var backupAgeRequirementInHours 0.0
- # When creating files for uploading through the Ftp menu, save them
- # with this eol format. Note that some ftp clients may translate
- # eols for you as they up/download.
- newPref var createFtpType unix global "" "mac unix ibm"
- # Number of pixels from left edge of window to start of text
- newPref var horMargin 4
- # Alpha will visually indent code by this many characters to
- # indicate its structure
- newPref var indentationAmount 4
- # If we have fewer than this many items in the opt-titlebar-menu,
- # add the contents of the current directory
- newPref var minItemsInTitlePopup 5
- # Used by 'Shift Left' and 'Shift Right' in the edit menu.
- newPref funnyChars shiftChar "\t"
- # The tiling items in the 'Arrange' menu will relocate this many
- # windows, starting with the front window and moving back.
- newPref var numWinsToTile 2
- newPref var tileHeight [expr {$screenHeight - 60}]
- newPref var tileLeft 2
- newPref var tileMargin 22
- newPref var tileProportion .60
- newPref var tileTop 40
- newPref var tileWidth [expr {$screenWidth - 10}]
- newPref linkvariable defLeft 2
- newPref linkvariable defTop 40
- newPref linkvariable defHeight $tileHeight
- newPref linkvariable defWidth [expr {$tileWidth > 510 ? 510 : $tileWidth}]
- # The fraction of the screen the small batch-search, or diff-style
- # windows use up.
- newPref var batchListWindowFraction 0.25 global win::SetProportions
- # The type of keyboard you have. This influences some of the keyboard
- # shortcuts Alpha places in the menus, and is used for better setting
- # of user-defined key-bindings.
- newPref variable keyboard US global keys::keyboardChanged keyboards array
- # This dictates the spelling Alpha uses for words like 'Colour/Color'
- newPref var spelling 0 global "" "American British" index
- # Useful for debugging some complex startup problems; you can choose
- # between logging all errors for later viewing, or displaying them
- # immediately
- newPref var reportErrors 1 global "" \
- [list "Log startup errors" "Report errors immediately"] index
- # re-read internet preferences from IC each startup
- newPref flag synchroniseWithInternetConfig 0
- # The font to use for printing documents
- newPref linkvariable printerFont "" global "" "system monaco courier geneva helvetica profont times {new york}"
- # The font-size to use for printing documents.
- newPref linkvariable printerFontSize "" global "" "7 9 10 12 14 18"
- # Default font to use for new windows
- newPref linkvariable defaultFont "monaco" global "" "system monaco courier geneva helvetica profont times {new york} programmer"
- # Default font size to use for new windows
- newPref linkvariable fontSize 9 global "" "7 9 10 12 14 18"
- # The amount of information to store in the resource fork of saved text
- # files. This can include font, tab, selection,... information. Here, 'think'
- # implies font, tab information, and 'mpw' adds window position and window
- # selection.
- newPref linkvariable savedState "" global "" "none think mpw"
- # The default size for a tab character for new windows (not the same as
- # the amount of space used for visual indentation of code).
- # Alpha can be configured to remember tab sizes for previously edited documents
- # -- see 'savedState' for details.
- newPref linkvariable tabSize 8
- # Regexp used for automatic word wrapping
- newPref linkvariable wrapBreak {[\w_]+}
- # Regexp used for automatic word wrapping
- newPref linkvariable wrapBreakPreface {([^\w_])}
- # Auto-wrap if the user types further than this column
- newPref linkvariable wrapHigh ""
- # Auto-un-wrap if the user deletes chars so a line is shorter than this
- newPref linkvariable wrapLow ""
- # The maximum number of changes before auto-saving occurs (if set via the
- # autoSave preference)
- newPref linkvariable changesLim ""
- # When wrapping text (see 'Word Wrap' preference), wrapping occurs
- # for any text beyond this column position. Used by all 'Fill' routines
- newPref linkvariable fillColumn 75
- # Set to the regular expression that ALPHA uses to find function declarations.
- newPref linkvariable funcExpr {^[^ \t\(#\r/@].*\(.*\)$}
- # The parenthesised regexp block to use for the func name
- newPref linkvariable funcPar 1
- # Number of blanks left at beginning of lines by 'fill' routines.
- newPref linkvariable leftFillColumn 0
- # Alpha asks the user if wrapping should be done whenever the user opens
- # files that have lines longer than 'paraColumn' characters
- newPref linkvariable paraColumn 180
- # Text column to use as the sort key when executing 'Sort Lines'.
- newPref linkvariable sortColumn 0
- # File to use for Tag searches.
- newPref linkio-file tagFile [file join $HOME cTAGS]
- # Margin size for printing
- newPref linkvariable leftMargin ""
- # Margin size for printing
- newPref linkvariable bottomMargin ""
- # Margin size for printing
- newPref linkvariable topMargin ""
- # Regular expression used to defines words for all internal operations. Most
- # modes have their own definition of this variable.
- newPref linkvariable wordBreak {\w+}
- # Prepended to 'wordBreak' when looking backwards for a word. Most
- # modes have their own definition of this variable.
- newPref linkvariable wordBreakPreface {(\W)}
- # Flags that won't appear in the menu.
- linkVar numLock
- # Usual place you use for downloading updates to Alpha and its packages.
- newPref var defaultAlphaDownloadSite "" global "" remote::site array
- # bug in alpha-IC interaction
- if {![catch "icGetPref DownloadFolder" res] && [file exists $res]} {
- # Default download location for files from the internet
- newPref var downloadFolder $res
- } else {
- newPref var downloadFolder $HOME
- }
- # if first item = code, then indent relative to code by given value of second arg
- # if first item = fixed, then force indentation to given level
- set indentationTypes [list "code 0" "code 4" "fixed 0"]
-
- lunion flagPrefs(Backups) backup undoOn autoSave
- lunion varPrefs(Backups) backupFolder backupExtension changesLim \
- backupAgeRequirementInHours
- lunion flagPrefs(Gui) blinkingCursor blockCursor coloring \
- dragAndDrop iconifyOnSwitch intelCutPaste lockStatus showInvisibles \
- smallMenuFont sortFuncsMenu tearoffMenus doubleSpaces hyperText
- lunion varPrefs(Gui) defaultFont fontSize tabSize sortColumn
- lunion flagPrefs(Printer) printHeader printHeaderFullPath printHeaderTime
- lunion varPrefs(Printer) bottomMargin printerFont printerFontSize \
- topMargin leftMargin
- lunion flagPrefs(Tags)
- lunion varPrefs(Tags) funcPar tagFile
- lunion flagPrefs(Window) autoHScroll forceMainScreen horScrollBar \
- moveInsertion powerThumb sortedIsDefault
- lunion varPrefs(Window) defHeight defLeft defTop defWidth \
- minItemsInTitlePopup savedState
- lunion flagPrefs(Tiling)
- lunion varPrefs(Tiling) numWinsToTile batchListWindowFraction horMargin \
- tileHeight tileProportion tileLeft tileMargin tileTop tileWidth
- lunion flagPrefs(Wrapping)
- lunion varPrefs(Wrapping) fillColumn leftFillColumn paraColumn wrapLow \
- wrapHigh
- lunion flagPrefs(Electrics) listPickIfMultCmps listPickIfNonUniqueStuckCmp \
- askDeleteSelection
- lunion varPrefs(Electrics) indentationAmount elecStopMarker
- lunion flagPrefs(Miscellaneous)
- lunion flagPrefs(Helpers)
- lunion varPrefs(Miscellaneous)
- lunion varPrefs(Helpers)
- lunion flagPrefs(WWW) synchroniseWithInternetConfig
- lunion varPrefs(WWW) defaultAlphaDownloadSite createFtpType downloadFolder \
- browserSig ftpSig httpDownloadSig
- lunion flagPrefs(International)
- lunion varPrefs(International) keyboard spelling
- lunion flagPrefs(Packages)
- lunion varPrefs(Packages) reportErrors
-
- proc alpha::addToPreferencePage {page args} {
- global varPrefs flagPrefs allFlags
- set vars [lremove -l $args $allFlags]
- set flags [lremove -l $args $vars]
- eval lunion varPrefs($page) $vars
- eval lunion flagPrefs($page) $flags
- }
-
- namespace eval indent {}
-
- set indent::amounts [list "nothing" "half-tab" "tab"]
-
- proc indent::setup {args} {
- global indent_amounts indentationAmount
- set indent_amounts(0) 0
- set indent_amounts(1) [expr {$indentationAmount/2}]
- set indent_amounts(2) $indentationAmount
- set indent_amounts(-1) [expr {-$indentationAmount/2}]
- set indent_amounts(-2) [expr {-$indentationAmount}]
- }
- indent::setup
- trace variable indentationAmount w indent::setup
-
- proc getFileSig {f} {
- getFileInfo $f arr
- if {[info exists arr(creator)]} {
- return $arr(creator)
- } else {
- return ""
- }
- }
-
- proc getFileType {f} {
- getFileInfo $f arr
- if {[info exists arr(type)]} {
- return $arr(type)
- } else {
- return "TEXT"
- }
- }
-
- # get defaults from internet config
- if {$synchroniseWithInternetConfig} {
- catch {set browserSig [getFileSig [icGetPref -t 1 Helper•http]]}
- catch {set ftpSig [getFileSig [icGetPref -t 1 Helper•ftp]]}
- } else {
- catch {ensureset browserSig [getFileSig [icGetPref -t 1 Helper•http]]}
- catch {ensureset ftpSig [getFileSig [icGetPref -t 1 Helper•ftp]]}
- }
-
- # The application signature of your internet browser
- newPref v browserSig MOSS
- # The application signature of your ftp client
- newPref v ftpSig Arch
- # The application signature of your internet browser to use for downloading
- # only (rather than viewing)
- newPref v httpDownloadSig $browserSig
-
- namespace eval win {}
-
- proc win::SetProportions {} {
- global tileHeight tileWidth tileTop tileLeft tileHeight \
- errorHeight errorDisp tileMargin batchListWindowFraction
- set errorHeight [expr {int ($batchListWindowFraction * ($tileHeight - $tileMargin))}]
- set errorDisp [expr {int ((1- $batchListWindowFraction) * ($tileHeight - $tileMargin))}]
- }
-
- proc wordWrapProc {val} {
- global mode wordWrap modifiedArrayElements
- global ${mode}modeVars
- set wordWrap $val
- set ${mode}modeVars(wordWrap) $val
- lappend modifiedArrayElements [list wordWrap ${mode}modeVars]
- }
-
-
- proc toggleNumLock {} {
- global numLock modifiedVars
-
- set numLock [expr {-1 * ($numLock - 1)}]
- lappend modifiedVars numLock
- }
-
- #============================================================================
- # declare these as modeVars in advance. I'm not sure it is necessary (Vince)
- lunion modeVars funcExpr wrapBreakPreface wrapBreak wordBreakPreface wordBreak
-
- # 'mode' is nothing when we start up.
- set mode {}
- set lastMode 0
- set reverting {}
-
- # For quithook
- set modifiedVars {}
- set modifiedArrVars {}
- set modifiedModeVars {}
- set modifiedArrayElements {}
-
- namespace eval win {}
- ensureset win::Active ""
-
-
-
-